import { useState, useTransition } from 'react'
import SearchResults from './SearchResults'

function App() {
  const [text, setText] = useState('');
  const [pending, startTransition] = useTransition()

  function onchange(e) {
    startTransition(() => {
      setText(e.target.value)
    })
  }

  return (
    <div className="App">
      <input type="text" 
        onChange={onchange} 
      />
      <div>{pending ? 'input...' : 'end' }</div>
      <SearchResults query={text} />
    </div>
  );
}

export default App;
